﻿namespace HRM.CORE.REPORT
{
    using DevExpress.Utils;
    using DevExpress.XtraBars;
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Controls;
    using DevExpress.XtraReports.UI;
    using APP.HELPER;
    using Common.Class; using APP.HELPER.Utils.Language; using Security.Security; using Dictionary.ERP;
    using Common.Report;
    using HRM.CORE;
    using Extra;
    using HRM.CORE.CLASS;
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms; using Common;

    public class xucOptionPrintTimekeeperTable : Common.xucBaseOptionPrint
    {
        private ComboBoxEdit cboStyle;
        private ComboBoxEdit cboTheme;
        private CheckEdit cheIsPrintNotNull;
        private CheckEdit cheIsShowExtraHour;
        private CheckEdit cheIsShowNightDutyDay;
        private CheckEdit cheIsShowPrivateHour;
        private clsOptionPrintTimekeeperTable cls;
        private Common.Class.clsAllOption clsAllOption;
        private IContainer components;
        private DateEdit dtDate;
        private GroupBox groupBox1;
        private LabelControl labelControl1;
        private LabelControl labelControl2;
        private LabelControl labelControl3;
        private LabelControl labelControl4;
        private string m_Code;
        private bool m_IsShowAll;
        private int m_Level;
        private int m_Month;
        private int m_Year;
        private PictureEdit ptTheme;
        private xucOrganizationEdit xucOrganizationEdit1;

        public xucOptionPrintTimekeeperTable(int Level, string Code)
        {
            this.m_Level = 0;
            this.m_Code = "";
            this.m_Month = 0;
            this.m_Year = 0;
            this.m_IsShowAll = false;
            this.clsAllOption = new Common.Class.clsAllOption();
            this.components = null;
            this.InitializeComponent();
            this.m_Level = Level;
            this.m_Code = Code;
            this.m_Month = this.clsAllOption.MonthDefault.Month;
            this.m_Year = this.clsAllOption.MonthDefault.Year;
            this.dtDate.DateTime = new System.DateTime(this.m_Year, this.m_Month, 1);
            this.xucOrganizationEdit1.LoadData(this.m_Level, this.m_Code);
        }

        public xucOptionPrintTimekeeperTable(int Level, string Code, int Month, int Year)
        {
            this.m_Level = 0;
            this.m_Code = "";
            this.m_Month = 0;
            this.m_Year = 0;
            this.m_IsShowAll = false;
            this.clsAllOption = new Common.Class.clsAllOption();
            this.components = null;
            this.InitializeComponent();
            this.m_Level = Level;
            this.m_Code = Code;
            this.m_Month = Month;
            this.m_Year = Year;
            this.dtDate.DateTime = new System.DateTime(this.m_Year, this.m_Month, 1);
            this.xucOrganizationEdit1.LoadData(this.m_Level, this.m_Code);
        }

        public xucOptionPrintTimekeeperTable(int Level, string Code, int Month, int Year, int Style)
        {
            this.m_Level = 0;
            this.m_Code = "";
            this.m_Month = 0;
            this.m_Year = 0;
            this.m_IsShowAll = false;
            this.clsAllOption = new Common.Class.clsAllOption();
            this.components = null;
            this.InitializeComponent();
            this.m_Level = Level;
            this.m_Code = Code;
            this.m_Month = Month;
            this.m_Year = Year;
            this.dtDate.DateTime = new System.DateTime(this.m_Year, this.m_Month, 1);
            this.xucOrganizationEdit1.LoadData(this.m_Level, this.m_Code);
            this.cboStyle.SelectedIndex = Style;
            this.cls = new clsOptionPrintTimekeeperTable();
            if (this.cboStyle.SelectedIndex == 0)
            {
                this.cboTheme.SelectedIndex = this.cls.Theme;
            }
            this.cheIsShowNightDutyDay.Checked = this.cls.IsShowNightDutyDay;
            this.cheIsShowExtraHour.Checked = this.cls.IsShowExtraHour;
            this.cheIsShowPrivateHour.Checked = this.cls.IsShowPrivateHour;
        }

        protected override void Cancel()
        {
            base.ParentForm.Close();
        }

        private void cboStyle_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.cboTheme.Properties.Items.Clear();
            this.cboTheme.SelectedIndex = -1;
            this.cheIsPrintNotNull.Visible = false;
            this.cheIsShowNightDutyDay.Visible = false;
            this.cheIsShowExtraHour.Visible = false;
            this.cheIsShowPrivateHour.Visible = false;
            if (this.cboStyle.SelectedIndex == 0)
            {
                this.cboTheme.Properties.Items.Add("Mẫu 1");
                this.cboTheme.Properties.Items.Add("Mẫu 2");
                if (this.cls != null)
                {
                    this.cboTheme.SelectedIndex = this.cls.Theme;
                }
            }
            else if (this.cboStyle.SelectedIndex == 1)
            {
                this.cboTheme.Properties.Items.Add("Mẫu 1");
                this.cboTheme.SelectedIndex = 0;
            }
            else if (this.cboStyle.SelectedIndex == 2)
            {
                this.cboTheme.Properties.Items.Add("Mẫu 1");
                this.cboTheme.SelectedIndex = 0;
            }
            else if (this.cboStyle.SelectedIndex == 3)
            {
                this.cboTheme.Properties.Items.Add("Mẫu 1");
                this.cboTheme.SelectedIndex = 0;
                this.cheIsPrintNotNull.Visible = true;
                this.cheIsPrintNotNull.Text = "Chỉ in những nh\x00e2n vi\x00ean c\x00f3 tăng cường giờ c\x00f4ng hoặc l\x00e0m việc ri\x00eang";
            }
            else if (this.cboStyle.SelectedIndex == 4)
            {
                this.cboTheme.Properties.Items.Add("Mẫu 1");
                this.cboTheme.SelectedIndex = 0;
                this.cheIsPrintNotNull.Visible = true;
                this.cheIsPrintNotNull.Text = "Chỉ in những nh\x00e2n vi\x00ean c\x00f3 tăng ca";
            }
            else if (this.cboStyle.SelectedIndex == 5)
            {
                this.cboTheme.Properties.Items.Add("Mẫu 1");
                this.cboTheme.SelectedIndex = 0;
                this.cheIsShowExtraHour.Visible = true;
                this.cheIsShowPrivateHour.Visible = true;
            }
        }

        private void cboTheme_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.cboStyle.SelectedIndex == 0)
            {
                if (this.cboTheme.SelectedIndex == 0)
                {
                    this.ptTheme.EditValue = ReportImageResc.rptTimeKeeperTableStyle1Theme1;
                }
                else
                {
                    this.ptTheme.EditValue = ReportImageResc.rptTimeKeeperTableStyle1Theme2;
                }
            }
            else if (this.cboStyle.SelectedIndex == 1)
            {
                this.ptTheme.EditValue = ReportImageResc.rptTimeKeeperTableStyle2Theme1;
            }
            else if (this.cboStyle.SelectedIndex == 2)
            {
                this.ptTheme.EditValue = ReportImageResc.rptTimeKeeperTableHour;
            }
            else if (this.cboStyle.SelectedIndex == 3)
            {
                this.ptTheme.EditValue = ReportImageResc.rptTimeKeeperExtraPrivate;
            }
            else if (this.cboStyle.SelectedIndex == 4)
            {
                this.ptTheme.EditValue = ReportImageResc.rptTimeKeeperTableOvertime;
            }
            else if (this.cboStyle.SelectedIndex == 5)
            {
                this.ptTheme.EditValue = ReportImageResc.rptTimeKeeperTotal;
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void dtDate_EditValueChanged(object sender, EventArgs e)
        {
            this.m_Month = this.dtDate.DateTime.Month;
            this.m_Year = this.dtDate.DateTime.Year;
        }

        private void InitializeComponent()
        {
            MenuButton button = new MenuButton();
            ItemCommand command = new ItemCommand();
            ItemCommand command2 = new ItemCommand();
            ItemCommand command3 = new ItemCommand();
            ItemCommand command4 = new ItemCommand();
            ItemCommand command5 = new ItemCommand();
            ItemCommand command6 = new ItemCommand();
            ItemCommand command7 = new ItemCommand();
            ItemCommand command8 = new ItemCommand();
            ItemCommand command9 = new ItemCommand();
            ItemCommand command10 = new ItemCommand();
            ItemCommand command11 = new ItemCommand();
            ItemCommand command12 = new ItemCommand();
            ItemCommand command13 = new ItemCommand();
            ItemCommand command14 = new ItemCommand();
            ItemCommand command15 = new ItemCommand();
            ItemCommand command16 = new ItemCommand();
            ItemCommand command17 = new ItemCommand();
            ItemCommand command18 = new ItemCommand();
            ItemCommand command19 = new ItemCommand();
            ItemCommand command20 = new ItemCommand();
            ItemCommand command21 = new ItemCommand();
            ItemCommand command22 = new ItemCommand();
            ItemCommand command23 = new ItemCommand();
            ItemCommand command24 = new ItemCommand();
            ItemCommand command25 = new ItemCommand();
            ItemCommand command26 = new ItemCommand();
            ItemCommand command27 = new ItemCommand();
            ItemCommand command28 = new ItemCommand();
            ItemCommand command29 = new ItemCommand();
            this.groupBox1 = new GroupBox();
            this.labelControl4 = new LabelControl();
            this.cheIsPrintNotNull = new CheckEdit();
            this.cheIsShowPrivateHour = new CheckEdit();
            this.cheIsShowExtraHour = new CheckEdit();
            this.cheIsShowNightDutyDay = new CheckEdit();
            this.cboTheme = new ComboBoxEdit();
            this.cboStyle = new ComboBoxEdit();
            this.labelControl2 = new LabelControl();
            this.ptTheme = new PictureEdit();
            this.labelControl3 = new LabelControl();
            this.labelControl1 = new LabelControl();
            this.dtDate = new DateEdit();
            this.xucOrganizationEdit1 = new xucOrganizationEdit();
            this.groupBox1.SuspendLayout();
            this.cheIsPrintNotNull.Properties.BeginInit();
            this.cheIsShowPrivateHour.Properties.BeginInit();
            this.cheIsShowExtraHour.Properties.BeginInit();
            this.cheIsShowNightDutyDay.Properties.BeginInit();
            this.cboTheme.Properties.BeginInit();
            this.cboStyle.Properties.BeginInit();
            this.ptTheme.Properties.BeginInit();
            this.dtDate.Properties.VistaTimeProperties.BeginInit();
            this.dtDate.Properties.BeginInit();
            base.SuspendLayout();
            base.btnPrintPreview.Location = new Point(0x1a9, 0x153);
            base.btnPrint.Location = new Point(0x156, 0x153);
            base.btnCancel.Location = new Point(0xfc, 0x153);
            this.groupBox1.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.groupBox1.Controls.Add(this.labelControl4);
            this.groupBox1.Controls.Add(this.xucOrganizationEdit1);
            this.groupBox1.Controls.Add(this.cheIsPrintNotNull);
            this.groupBox1.Controls.Add(this.cheIsShowPrivateHour);
            this.groupBox1.Controls.Add(this.cheIsShowExtraHour);
            this.groupBox1.Controls.Add(this.cheIsShowNightDutyDay);
            this.groupBox1.Controls.Add(this.cboTheme);
            this.groupBox1.Controls.Add(this.cboStyle);
            this.groupBox1.Controls.Add(this.labelControl2);
            this.groupBox1.Controls.Add(this.ptTheme);
            this.groupBox1.Controls.Add(this.labelControl3);
            this.groupBox1.Controls.Add(this.labelControl1);
            this.groupBox1.Controls.Add(this.dtDate);
            this.groupBox1.Location = new Point(12, 3);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new Size(0x1f8, 0x143);
            this.groupBox1.TabIndex = 0x25;
            this.groupBox1.TabStop = false;
            this.labelControl4.Location = new Point(14, 0x12);
            this.labelControl4.Name = "labelControl4";
            this.labelControl4.Size = new Size(0x3d, 13);
            this.labelControl4.TabIndex = 0x27;
            this.labelControl4.Text = "Chọn đơn vị:";
            this.cheIsPrintNotNull.EditValue = true;
            this.cheIsPrintNotNull.Location = new Point(12, 0x73);
            this.cheIsPrintNotNull.Name = "cheIsPrintNotNull";
            this.cheIsPrintNotNull.Properties.Appearance.Options.UseTextOptions = true;
            this.cheIsPrintNotNull.Properties.Appearance.TextOptions.WordWrap = WordWrap.Wrap;
            this.cheIsPrintNotNull.Properties.AutoHeight = false;
            this.cheIsPrintNotNull.Properties.Caption = "cheIsPrintNotNull";
            this.cheIsPrintNotNull.Size = new Size(0xb3, 0x2e);
            this.cheIsPrintNotNull.TabIndex = 0x11;
            this.cheIsShowPrivateHour.Location = new Point(12, 0x11e);
            this.cheIsShowPrivateHour.Name = "cheIsShowPrivateHour";
            this.cheIsShowPrivateHour.Properties.Caption = "Hiển thị số giờ l\x00e0m việc ri\x00eang";
            this.cheIsShowPrivateHour.Size = new Size(0xb3, 0x13);
            this.cheIsShowPrivateHour.TabIndex = 0x11;
            this.cheIsShowExtraHour.Location = new Point(12, 0x105);
            this.cheIsShowExtraHour.Name = "cheIsShowExtraHour";
            this.cheIsShowExtraHour.Properties.Caption = "Hiển thị số giờ tăng cường";
            this.cheIsShowExtraHour.Size = new Size(0xb3, 0x13);
            this.cheIsShowExtraHour.TabIndex = 0x11;
            this.cheIsShowNightDutyDay.Location = new Point(12, 0xec);
            this.cheIsShowNightDutyDay.Name = "cheIsShowNightDutyDay";
            this.cheIsShowNightDutyDay.Properties.Caption = "Hiển thị số ng\x00e0y trực đ\x00eam";
            this.cheIsShowNightDutyDay.Size = new Size(0xb3, 0x13);
            this.cheIsShowNightDutyDay.TabIndex = 0x11;
            this.cboTheme.EditValue = "";
            this.cboTheme.Location = new Point(0x51, 0x59);
            this.cboTheme.Name = "cboTheme";
            this.cboTheme.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.cboTheme.Properties.TextEditStyle = TextEditStyles.DisableTextEditor;
            this.cboTheme.Size = new Size(110, 20);
            this.cboTheme.TabIndex = 0x10;
            this.cboTheme.SelectedIndexChanged += new EventHandler(this.cboTheme_SelectedIndexChanged);
            this.cboStyle.Location = new Point(210, 0x3f);
            this.cboStyle.Name = "cboStyle";
            this.cboStyle.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.cboStyle.Properties.Items.AddRange(new object[] { "Bảng Chấm C\x00f4ng Theo K\x00fd Hiệu - Dạng 1", "Bảng Chấm C\x00f4ng Theo K\x00fd Hiệu - Dạng 2", "Bảng Chấm C\x00f4ng Theo Giờ C\x00f4ng", "Bảng Chấm C\x00f4ng Tăng Cường Giờ C\x00f4ng, L\x00e0m Việc Ri\x00eang", "Bảng Chấm C\x00f4ng Tăng Ca", "Bảng Tổng Hợp Ng\x00e0y C\x00f4ng" });
            this.cboStyle.Properties.TextEditStyle = TextEditStyles.DisableTextEditor;
            this.cboStyle.Size = new Size(280, 20);
            this.cboStyle.TabIndex = 0x10;
            this.cboStyle.SelectedIndexChanged += new EventHandler(this.cboStyle_SelectedIndexChanged);
            this.labelControl2.Location = new Point(14, 0x5c);
            this.labelControl2.Name = "labelControl2";
            this.labelControl2.Size = new Size(0x34, 13);
            this.labelControl2.TabIndex = 15;
            this.labelControl2.Text = "Chọn mẫu:";
            this.ptTheme.Location = new Point(210, 0x5b);
            this.ptTheme.Name = "ptTheme";
            this.ptTheme.Properties.AllowFocused = false;
            this.ptTheme.Properties.Appearance.BackColor = Color.Transparent;
            this.ptTheme.Properties.Appearance.Options.UseBackColor = true;
            this.ptTheme.Properties.BorderStyle = BorderStyles.Simple;
            this.ptTheme.Size = new Size(280, 220);
            this.ptTheme.TabIndex = 14;
            this.labelControl3.Location = new Point(0xd3, 0x2c);
            this.labelControl3.Name = "labelControl3";
            this.labelControl3.Size = new Size(120, 13);
            this.labelControl3.TabIndex = 13;
            this.labelControl3.Text = "Chọn loại b\x00e1o c\x00e1o cần in:";
            this.labelControl1.Location = new Point(14, 0x40);
            this.labelControl1.Name = "labelControl1";
            this.labelControl1.Size = new Size(60, 13);
            this.labelControl1.TabIndex = 13;
            this.labelControl1.Text = "Chọn th\x00e1ng:";
            this.dtDate.EditValue = null;
            this.dtDate.Location = new Point(0x51, 0x3e);
            this.dtDate.Name = "dtDate";
            this.dtDate.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.dtDate.Properties.Appearance.Options.UseFont = true;
            this.dtDate.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.dtDate.Properties.DisplayFormat.FormatString = "MM/yyyy";
            this.dtDate.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
            this.dtDate.Properties.EditFormat.FormatString = "MM/yyyy";
            this.dtDate.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
            this.dtDate.Properties.Mask.EditMask = "MM/yyyy";
            this.dtDate.Properties.VistaTimeProperties.Buttons.AddRange(new EditorButton[] { new EditorButton() });
            this.dtDate.Size = new Size(110, 20);
            this.dtDate.TabIndex = 12;
            this.dtDate.EditValueChanged += new EventHandler(this.dtDate_EditValueChanged);
            this.xucOrganizationEdit1.BranchCode = null;
            this.xucOrganizationEdit1.Code = null;
            this.xucOrganizationEdit1.DepartmentCode = null;
            this.xucOrganizationEdit1.EmployeeCode = null;
            this.xucOrganizationEdit1.GroupCode = null;
            this.xucOrganizationEdit1.IsClose = CloseOrNew.None;
            this.xucOrganizationEdit1.Level = 0;
            this.xucOrganizationEdit1.Location = new Point(0x51, 0x10);
            this.xucOrganizationEdit1.Name = "xucOrganizationEdit1";
            this.xucOrganizationEdit1.NotSave = false;
            command.Caption = "";
            command.Enable = false;
            command.Visibility = BarItemVisibility.Never;
            button.Add = command;
            command2.Caption = "";
            command2.Enable = false;
            command2.Visibility = BarItemVisibility.Never;
            button.Cancel = command2;
            command3.Caption = "";
            command3.Enable = false;
            command3.Visibility = BarItemVisibility.Never;
            button.Change = command3;
            command4.Caption = "";
            command4.Enable = false;
            command4.Visibility = BarItemVisibility.Never;
            button.Close = command4;
            command5.Caption = "";
            command5.Enable = false;
            command5.Visibility = BarItemVisibility.Never;
            button.Custom = command5;
            command6.Caption = "";
            command6.Enable = false;
            command6.Visibility = BarItemVisibility.Never;
            button.Delete = command6;
            command7.Caption = "";
            command7.Enable = false;
            command7.Visibility = BarItemVisibility.Never;
            button.Export = command7;
            command8.Caption = "";
            command8.Enable = false;
            command8.Visibility = BarItemVisibility.Never;
            button.Filter = command8;
            command9.Caption = "";
            command9.Enable = false;
            command9.Visibility = BarItemVisibility.Never;
            button.FilterCustomer = command9;
            command10.Caption = "";
            command10.Enable = false;
            command10.Visibility = BarItemVisibility.Never;
            button.FilterStock = command10;
            command11.Caption = "";
            command11.Enable = false;
            command11.Visibility = BarItemVisibility.Never;
            button.Find = command11;
            button.GClose = false;
            button.GCommand = false;
            button.GExport = false;
            command12.Caption = "";
            command12.Enable = false;
            command12.Visibility = BarItemVisibility.Never;
            button.Go = command12;
            button.GOption = false;
            button.GPrint = false;
            button.GRecords = false;
            button.GSearchBar = false;
            button.GSettings = false;
            button.GVaildation = false;
            command13.Caption = "";
            command13.Enable = false;
            command13.Visibility = BarItemVisibility.Never;
            button.Import = command13;
            command14.Caption = "";
            command14.Enable = false;
            command14.Visibility = BarItemVisibility.Never;
            button.Next = command14;
            command15.Caption = "";
            command15.Enable = false;
            command15.Visibility = BarItemVisibility.Never;
            button.PageSetup = command15;
            button.PHome = false;
            command16.Caption = "";
            command16.Enable = false;
            command16.Visibility = BarItemVisibility.Never;
            button.Previous = command16;
            command17.Caption = "";
            command17.Enable = false;
            command17.Visibility = BarItemVisibility.Never;
            button.Print = command17;
            command18.Caption = "";
            command18.Enable = false;
            command18.Visibility = BarItemVisibility.Never;
            button.PrintPreview = command18;
            button.PTool = false;
            command19.Caption = "";
            command19.Enable = false;
            command19.Visibility = BarItemVisibility.Never;
            button.Redo = command19;
            command20.Caption = "";
            command20.Enable = false;
            command20.Visibility = BarItemVisibility.Never;
            button.Refresh = command20;
            command21.Caption = "";
            command21.Enable = false;
            command21.Visibility = BarItemVisibility.Never;
            button.Save = command21;
            command22.Caption = "";
            command22.Enable = false;
            command22.Visibility = BarItemVisibility.Never;
            button.SaveAndClose = command22;
            command23.Caption = "";
            command23.Enable = false;
            command23.Visibility = BarItemVisibility.Never;
            button.SaveAndNew = command23;
            command24.Caption = "";
            command24.Enable = false;
            command24.Visibility = BarItemVisibility.Never;
            button.Search = command24;
            command25.Caption = "";
            command25.Enable = false;
            command25.Visibility = BarItemVisibility.Never;
            button.SearchText = command25;
            command26.Caption = "";
            command26.Enable = false;
            command26.Visibility = BarItemVisibility.Never;
            button.Task = command26;
            command27.Caption = "";
            command27.Enable = false;
            command27.Visibility = BarItemVisibility.Never;
            button.Undo = command27;
            command28.Caption = "";
            command28.Enable = false;
            command28.Visibility = BarItemVisibility.Never;
            button.Vaildate = command28;
            command29.Caption = "";
            command29.Enable = false;
            command29.Visibility = BarItemVisibility.Never;
            button.View = command29;
            this.xucOrganizationEdit1.RibbonBar = button;
            this.xucOrganizationEdit1.Size = new Size(0x199, 0x16);
            this.xucOrganizationEdit1.Status = Actions.None;
            this.xucOrganizationEdit1.TabIndex = 0x26;
            this.xucOrganizationEdit1.Title = "";
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.Controls.Add(this.groupBox1);
            base.Name = "xucOptionPrintTimekeeperTable";
            base.Size = new Size(0x211, 0x17a);
            base.Controls.SetChildIndex(base.btnPrintPreview, 0);
            base.Controls.SetChildIndex(base.btnPrint, 0);
            base.Controls.SetChildIndex(base.btnCancel, 0);
            base.Controls.SetChildIndex(this.groupBox1, 0);
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.cheIsPrintNotNull.Properties.EndInit();
            this.cheIsShowPrivateHour.Properties.EndInit();
            this.cheIsShowExtraHour.Properties.EndInit();
            this.cheIsShowNightDutyDay.Properties.EndInit();
            this.cboTheme.Properties.EndInit();
            this.cboStyle.Properties.EndInit();
            this.ptTheme.Properties.EndInit();
            this.dtDate.Properties.VistaTimeProperties.EndInit();
            this.dtDate.Properties.EndInit();
            base.ResumeLayout(false);
        }

        protected override void Print()
        {
            this.Print(false);
        }

        private void Print(bool IsPrintPreview)
        {
            this.m_Level = this.xucOrganizationEdit1.Level;
            this.m_Code = this.xucOrganizationEdit1.Code;
            XtraReport xtraReport = new XtraReport();
            if (this.cheIsPrintNotNull.Checked)
            {
                this.m_IsShowAll = false;
            }
            else
            {
                this.m_IsShowAll = true;
            }
            clsOptionPrintTimekeeperTable table = new clsOptionPrintTimekeeperTable();
            if (this.cboStyle.SelectedIndex == 0)
            {
                table.Theme = this.cboTheme.SelectedIndex;
            }
            table.IsShowNightDutyDay = this.cheIsShowNightDutyDay.Checked;
            table.IsShowExtraHour = this.cheIsShowExtraHour.Checked;
            table.IsShowPrivateHour = this.cheIsShowPrivateHour.Checked;
            table.SaveOption();
            xfmReport report2 = new xfmReport();
            report2.SetTitle("Bảng Chấm C\x00f4ng Th\x00e1ng " + this.m_Month.ToString() + "/" + this.m_Year.ToString());
            HRM_TIMEKEEPER_TABLELIST hrm_timekeeper_tablelist = new HRM_TIMEKEEPER_TABLELIST();
            if (!hrm_timekeeper_tablelist.Exist(this.m_Month, this.m_Year))
            {
                XtraMessageBox.Show("Bảng xếp ca th\x00e1ng n\x00e0y kh\x00f4ng tồn tại trong cơ sở dữ liệu của chương tr\x00ecnh!\nVui l\x00f2ng chọn th\x00e1ng b\x00e1o c\x00e1o kh\x00e1c!", "Th\x00f4ng B\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                if (this.cboStyle.SelectedIndex == 0)
                {
                    if (this.cboTheme.SelectedIndex == 0)
                    {
                        xtraReport = new rptTimekeeperTableStyle1Theme1(this.m_Level, this.m_Code, this.m_Month, this.m_Year);
                    }
                    else
                    {
                        xtraReport = new rptTimekeeperTableStyle1Theme2(this.m_Level, this.m_Code, this.m_Month, this.m_Year);
                    }
                }
                else if (this.cboStyle.SelectedIndex == 1)
                {
                    xtraReport = new rptTimekeeperTableStyle2Theme1(this.m_Level, this.m_Code, this.m_Month, this.m_Year);
                }
                else if (this.cboStyle.SelectedIndex == 2)
                {
                    xtraReport = new rptTimekeeperTableHour(this.m_Level, this.m_Code, this.m_Month, this.m_Year);
                }
                else if (this.cboStyle.SelectedIndex == 3)
                {
                    report2.SetTitle("Bảng Chấm Tăng Cường Giờ C\x00f4ng, L\x00e0m Việc Ri\x00eang - Th\x00e1ng " + this.m_Month.ToString() + "/" + this.m_Year.ToString());
                    xtraReport = new rptTimekeeperExtraPrivate(this.m_Level, this.m_Code, this.m_Month, this.m_Year, this.m_IsShowAll);
                }
                else if (this.cboStyle.SelectedIndex == 4)
                {
                    report2.SetTitle("Bảng Chấm C\x00f4ng Tăng Ca - Th\x00e1ng " + this.m_Month.ToString() + "/" + this.m_Year.ToString());
                    xtraReport = new rptTimekeeperOverTime(this.m_Level, this.m_Code, this.m_Month, this.m_Year, this.m_IsShowAll);
                }
                else if (this.cboStyle.SelectedIndex == 5)
                {
                    report2.SetTitle("Bảng Tổng Hợp Ng\x00e0y C\x00f4ng - Th\x00e1ng " + this.m_Month.ToString() + "/" + this.m_Year.ToString());
                    xtraReport = new rptTimekeeperTotal(this.m_Level, this.m_Code, this.m_Month, this.m_Year);
                }
                if (IsPrintPreview)
                {
                    report2.ShowPrintPreview(xtraReport);
                }
                else
                {
                    PrintDialog dialog = new PrintDialog();
                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        string printerName = dialog.PrinterSettings.PrinterName;
                        xtraReport.Print(printerName);
                    }
                }
            }
        }

        protected override void PrintPreview()
        {
            this.Print(true);
        }
    }
}

